﻿using jianvgroup.com.Common;
using System;

namespace jianvgroup.com.Models
{
    public class BasePageModel
    {
        public string SearchKeyWord { get; set; }

        /// <summary>
        /// 参数ID
        /// </summary>
        public string id { get; set; }

        public virtual string ActionName
        {
            get
            {
                return "Index";
            }
        }

        public int TotalCount { get; set; }

        public int CurrentIndex { get; set; }

        public int PageSize { get { return Constant._PAGESIZE; } }

        public int TotalPages
        {
            get
            {
                return (int)Math.Ceiling((double)TotalCount / (double)PageSize);
            }
        }

        /// <summary>
        /// 分页显示最大页数
        /// </summary>
        public virtual int DisplayMaxPages
        {
            get
            {
                return 10;
            }
        }

        public bool IsHasPrePage
        {
            get
            {
                return CurrentIndex != 1;
            }
        }

        public bool IsHasNextPage
        {
            get
            {
                return CurrentIndex != TotalPages;
            }
        }
    }
}
